.class public Lcom/zuimeia/ui/tag/TagListView;
.super Lcom/zuimeia/ui/tag/FlowLayout;
.source "TagListView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;,
        Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;
    }
.end annotation


# instance fields
.field private mCloseBg:I

.field private mDefaultBg:I

.field private mOnTagClickListener:Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;

.field private mTagBgs:[I

.field private final mTags:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/zuimeia/ui/tag/TagModel;",
            ">;"
        }
    .end annotation
.end field

.field private onTagLayoutChangeListener:Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 28
    invoke-direct {p0, p1}, Lcom/zuimeia/ui/tag/FlowLayout;-><init>(Landroid/content/Context;)V

    .line 22
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    .line 29
    invoke-direct {p0}, Lcom/zuimeia/ui/tag/TagListView;->init()V

    .line 30
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attributeSet"    # Landroid/util/AttributeSet;

    .prologue
    .line 33
    invoke-direct {p0, p1, p2}, Lcom/zuimeia/ui/tag/FlowLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 22
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    .line 34
    invoke-direct {p0}, Lcom/zuimeia/ui/tag/TagListView;->init()V

    .line 35
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .registers 5
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attributeSet"    # Landroid/util/AttributeSet;
    .param p3, "defStyle"    # I

    .prologue
    .line 38
    invoke-direct {p0, p1, p2, p3}, Lcom/zuimeia/ui/tag/FlowLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 22
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    .line 39
    invoke-direct {p0}, Lcom/zuimeia/ui/tag/TagListView;->init()V

    .line 40
    return-void
.end method

.method static synthetic access$000(Lcom/zuimeia/ui/tag/TagListView;)Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/tag/TagListView;

    .prologue
    .line 20
    iget-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->onTagLayoutChangeListener:Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;

    return-object v0
.end method

.method static synthetic access$100(Lcom/zuimeia/ui/tag/TagListView;)Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;
    .registers 2
    .param p0, "x0"    # Lcom/zuimeia/ui/tag/TagListView;

    .prologue
    .line 20
    iget-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mOnTagClickListener:Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;

    return-object v0
.end method

.method private inflateTagView(Lcom/zuimeia/ui/tag/TagModel;ZI)V
    .registers 13
    .param p1, "tag"    # Lcom/zuimeia/ui/tag/TagModel;
    .param p2, "checkEnable"    # Z
    .param p3, "bgResId"    # I

    .prologue
    const/4 v8, 0x0

    .line 88
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getContext()Landroid/content/Context;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$layout;->layout_tag:I

    const/4 v7, 0x0

    invoke-static {v5, v6, v7}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    .line 89
    .local v4, "tagView":Landroid/widget/TextView;
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$dimen;->tag_padding_left:I

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v1

    .line 90
    .local v1, "paddingLeft":I
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$dimen;->tag_padding_right:I

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v2

    .line 91
    .local v2, "paddingRight":I
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$dimen;->tag_padding_top:I

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v3

    .line 92
    .local v3, "paddingTop":I
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$dimen;->tag_padding_bottom:I

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v0

    .line 93
    .local v0, "paddingBottom":I
    iget-object v5, p1, Lcom/zuimeia/ui/tag/TagModel;->title:Ljava/lang/String;

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 94
    invoke-virtual {v4, p1}, Landroid/widget/TextView;->setTag(Ljava/lang/Object;)V

    .line 96
    invoke-virtual {v4, p2}, Landroid/widget/TextView;->setSelected(Z)V

    .line 97
    invoke-virtual {v4, p3}, Landroid/widget/TextView;->setBackgroundResource(I)V

    .line 98
    iget-boolean v5, p1, Lcom/zuimeia/ui/tag/TagModel;->canDeleted:Z

    if-eqz v5, :cond_57

    .line 99
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getResources()Landroid/content/res/Resources;

    move-result-object v5

    sget v6, Lcom/zuimeia/ui/R$dimen;->tag_padding_right_candeleted:I

    invoke-virtual {v5, v6}, Landroid/content/res/Resources;->getDimensionPixelOffset(I)I

    move-result v2

    .line 100
    iget v5, p0, Lcom/zuimeia/ui/tag/TagListView;->mCloseBg:I

    invoke-virtual {v4, v8, v8, v5, v8}, Landroid/widget/TextView;->setCompoundDrawablesWithIntrinsicBounds(IIII)V

    .line 102
    :cond_57
    invoke-virtual {v4, v1, v3, v2, v0}, Landroid/widget/TextView;->setPadding(IIII)V

    .line 104
    new-instance v5, Lcom/zuimeia/ui/tag/TagListView$1;

    invoke-direct {v5, p0, p1, v4}, Lcom/zuimeia/ui/tag/TagListView$1;-><init>(Lcom/zuimeia/ui/tag/TagListView;Lcom/zuimeia/ui/tag/TagModel;Landroid/widget/TextView;)V

    invoke-virtual {v4, v5}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 127
    invoke-virtual {p0, v4}, Lcom/zuimeia/ui/tag/TagListView;->addView(Landroid/view/View;)V

    .line 128
    return-void
.end method

.method private init()V
    .registers 1

    .prologue
    .line 44
    return-void
.end method


# virtual methods
.method public addTag(Lcom/zuimeia/ui/tag/TagModel;ZI)V
    .registers 5
    .param p1, "tag"    # Lcom/zuimeia/ui/tag/TagModel;
    .param p2, "checkEnable"    # Z
    .param p3, "bgResId"    # I

    .prologue
    .line 53
    iget-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 54
    invoke-direct {p0, p1, p2, p3}, Lcom/zuimeia/ui/tag/TagListView;->inflateTagView(Lcom/zuimeia/ui/tag/TagModel;ZI)V

    .line 55
    return-void
.end method

.method public getSelectedCount()I
    .registers 6

    .prologue
    .line 168
    const/4 v0, 0x0

    .line 169
    .local v0, "count":I
    const/4 v1, 0x0

    .local v1, "i":I
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getChildCount()I

    move-result v2

    .local v2, "size":I
    :goto_6
    if-ge v1, v2, :cond_19

    .line 170
    invoke-virtual {p0, v1}, Lcom/zuimeia/ui/tag/TagListView;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    .line 171
    .local v3, "view":Landroid/view/View;
    if-eqz v3, :cond_16

    invoke-virtual {v3}, Landroid/view/View;->isSelected()Z

    move-result v4

    if-eqz v4, :cond_16

    .line 172
    add-int/lit8 v0, v0, 0x1

    .line 169
    :cond_16
    add-int/lit8 v1, v1, 0x1

    goto :goto_6

    .line 175
    .end local v3    # "view":Landroid/view/View;
    :cond_19
    return v0
.end method

.method public getTagList()Ljava/util/List;
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/zuimeia/ui/tag/TagModel;",
            ">;"
        }
    .end annotation

    .prologue
    .line 152
    new-instance v3, Ljava/util/LinkedList;

    invoke-direct {v3}, Ljava/util/LinkedList;-><init>()V

    .line 153
    .local v3, "tagList":Ljava/util/List;, "Ljava/util/List<Lcom/zuimeia/ui/tag/TagModel;>;"
    const/4 v0, 0x0

    .local v0, "i":I
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->getChildCount()I

    move-result v1

    .local v1, "size":I
    :goto_a
    if-ge v0, v1, :cond_24

    .line 154
    invoke-virtual {p0, v0}, Lcom/zuimeia/ui/tag/TagListView;->getChildAt(I)Landroid/view/View;

    move-result-object v4

    .line 155
    .local v4, "view":Landroid/view/View;
    if-eqz v4, :cond_21

    invoke-virtual {v4}, Landroid/view/View;->isSelected()Z

    move-result v5

    if-eqz v5, :cond_21

    .line 157
    :try_start_18
    invoke-virtual {v4}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/zuimeia/ui/tag/TagModel;

    .line 158
    .local v2, "tag":Lcom/zuimeia/ui/tag/TagModel;
    invoke-interface {v3, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_21
    .catch Ljava/lang/Throwable; {:try_start_18 .. :try_end_21} :catch_25

    .line 153
    .end local v2    # "tag":Lcom/zuimeia/ui/tag/TagModel;
    :cond_21
    :goto_21
    add-int/lit8 v0, v0, 0x1

    goto :goto_a

    .line 164
    .end local v4    # "view":Landroid/view/View;
    :cond_24
    return-object v3

    .line 159
    .restart local v4    # "view":Landroid/view/View;
    :catch_25
    move-exception v5

    goto :goto_21
.end method

.method public getTags()Ljava/util/List;
    .registers 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/zuimeia/ui/tag/TagModel;",
            ">;"
        }
    .end annotation

    .prologue
    .line 70
    iget-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    return-object v0
.end method

.method public getViewByTag(Lcom/zuimeia/ui/tag/TagModel;)Landroid/view/View;
    .registers 3
    .param p1, "tag"    # Lcom/zuimeia/ui/tag/TagModel;

    .prologue
    .line 79
    invoke-virtual {p0, p1}, Lcom/zuimeia/ui/tag/TagListView;->findViewWithTag(Ljava/lang/Object;)Landroid/view/View;

    move-result-object v0

    return-object v0
.end method

.method public inflateTagView(Lcom/zuimeia/ui/tag/TagModel;Z)V
    .registers 4
    .param p1, "tag"    # Lcom/zuimeia/ui/tag/TagModel;
    .param p2, "checkEnable"    # Z

    .prologue
    .line 83
    iget v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mDefaultBg:I

    invoke-direct {p0, p1, p2, v0}, Lcom/zuimeia/ui/tag/TagListView;->inflateTagView(Lcom/zuimeia/ui/tag/TagModel;ZI)V

    .line 84
    return-void
.end method

.method public initData([III)V
    .registers 4
    .param p1, "tagBgs"    # [I
    .param p2, "defaultBg"    # I
    .param p3, "closeBg"    # I

    .prologue
    .line 47
    iput p2, p0, Lcom/zuimeia/ui/tag/TagListView;->mDefaultBg:I

    .line 48
    iput-object p1, p0, Lcom/zuimeia/ui/tag/TagListView;->mTagBgs:[I

    .line 49
    iput p3, p0, Lcom/zuimeia/ui/tag/TagListView;->mCloseBg:I

    .line 50
    return-void
.end method

.method public removeTag(Lcom/zuimeia/ui/tag/TagModel;)V
    .registers 3
    .param p1, "tag"    # Lcom/zuimeia/ui/tag/TagModel;

    .prologue
    .line 74
    iget-object v0, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 75
    invoke-virtual {p0, p1}, Lcom/zuimeia/ui/tag/TagListView;->getViewByTag(Lcom/zuimeia/ui/tag/TagModel;)Landroid/view/View;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/zuimeia/ui/tag/TagListView;->removeView(Landroid/view/View;)V

    .line 76
    return-void
.end method

.method public setOnTagClickListener(Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;)V
    .registers 2
    .param p1, "listener"    # Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;

    .prologue
    .line 136
    iput-object p1, p0, Lcom/zuimeia/ui/tag/TagListView;->mOnTagClickListener:Lcom/zuimeia/ui/tag/TagListView$OnTagClickListener;

    .line 137
    return-void
.end method

.method public setOnTagLayoutChangeListener(Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;)V
    .registers 2
    .param p1, "onTagLayoutChangeListener"    # Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;

    .prologue
    .line 142
    iput-object p1, p0, Lcom/zuimeia/ui/tag/TagListView;->onTagLayoutChangeListener:Lcom/zuimeia/ui/tag/TagListView$OnTagLayoutChangeListener;

    .line 143
    return-void
.end method

.method public setTags(Ljava/util/List;)V
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<+",
            "Lcom/zuimeia/ui/tag/TagModel;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 58
    .local p1, "tags":Ljava/util/List;, "Ljava/util/List<+Lcom/zuimeia/ui/tag/TagModel;>;"
    if-nez p1, :cond_3

    .line 67
    :cond_2
    return-void

    .line 61
    :cond_3
    invoke-virtual {p0}, Lcom/zuimeia/ui/tag/TagListView;->removeAllViews()V

    .line 62
    iget-object v1, p0, Lcom/zuimeia/ui/tag/TagListView;->mTags:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->clear()V

    .line 63
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_c
    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_2

    .line 64
    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/zuimeia/ui/tag/TagModel;

    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/zuimeia/ui/tag/TagModel;

    iget-boolean v2, v2, Lcom/zuimeia/ui/tag/TagModel;->isSelected:Z

    iget-object v3, p0, Lcom/zuimeia/ui/tag/TagListView;->mTagBgs:[I

    rem-int/lit8 v4, v0, 0xa

    aget v3, v3, v4

    invoke-virtual {p0, v1, v2, v3}, Lcom/zuimeia/ui/tag/TagListView;->addTag(Lcom/zuimeia/ui/tag/TagModel;ZI)V

    .line 63
    add-int/lit8 v0, v0, 0x1

    goto :goto_c
.end method
